package ThreadPool2;

import java.io.IOException;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.net.Socket;
import java.net.UnknownHostException;
import java.util.Scanner;

public class TCPClient2 {
    private static Socket s;
    public static void main(String[] args) throws IOException {
        try{
        s = new Socket("127.0.0.1" , 9999);
        Scanner in = new Scanner(System.in);
        String msg = null;
            PrintWriter out = new PrintWriter(new OutputStreamWriter(s.getOutputStream()));
        while ((msg = in.nextLine()) != null){
            if(msg.equals('Q'))
                break;
          out.println(msg);
          out.flush();

        }
            s.close();
    }
        catch (
    UnknownHostException e) {
        e.printStackTrace();
    }
        catch (
    IOException e) {
        e.printStackTrace();
    }

}
}
